import random
f=open("名单.txt","r",encoding="utf-8")
list=f.readlines()
# list=[]
# for i in f:
#     i = i.replace('\n','')
#     list.append(i)
f.close()
while 1:
    if len(list)==0:
        print("结束")
        break
    num = random.randint(0, len(list) - 1)
    a = input('输入b退出，其他值继续:')
    if a == 'b':
        print('结束')
        break
    else:
        print(f'本次被点到名的是:{list[num]}')
        f1 = open("临时.txt", "a", encoding="utf-8")
        f1.write(list[num])
        f1.write("\n")
        f1.close()
    f2 = open("名单.txt", "w", encoding="utf-8")
    for i,line in f2:
        if list[num] not in f1:
            f2.write(line)
    f2.close()
    list.pop(num)
# f.close()